

<div class="container">
	<div class="module mod-line-top">
		<h2>历史 记录</h2>
		<table class="table table-striped table-hover">
			<thead>
			  	<tr>
				    <th>#</th>
				    <th>游戏账号</th>
				    <th>游戏名称</th>
				    <th>新币</th>
				    <th>汇率</th>
				    <th>人民币</th>
				    <th>状态</th>
				    <th>操作</th>
			  	</tr>
			</thead>
			<tbody>
				<?php $index = $this->uri->segment(3);
				?>
				<?php foreach ($results as $item): $offset++;?>
				<tr>
				    <td><?=$offset?></td>
				    <td><?=$item['account_no']?></td>
				    <td><?=$gamelookup[$item['account_type']]?></td>
		    		<td><?=$item['sg_money']?></td>
				    <td><?=$item['rate']?></td>
				    <td><?=$item['cn_money']?></td>
				    <td><?=$statuslookup[$item['status']]?></td>
				    <td>
				    	<div class="btn-group">
					        <button type="button" class="btn btn-primary bill-view" id="<?=$item['id']?>">查看</button>
					        <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
					          <span class="caret"></span>
					          <span class="sr-only">Toggle Dropdown</span>
					        </button>
					        <ul class="dropdown-menu" role="menu">
					        <?if($item['status'] == 'P' || $item['status'] == 'C'){?>
					          <li><a href="/index.php/bill/download/receipt1/<?=$item['id']?>" target="downloadframe">下载银行转账发票</a></li>
					        <?}?>
					        <?if($item['status'] == 'C'){?>
					          <li><a href="/index.php/bill/download/receipt2/<?=$item['id']?>" target="downloadframe">下载客服充值发票</a></li>
					        <?}?>
					        </ul>
				      	</div>
      				</td>
			  	</tr>
				<?php endforeach ?>
			  	
			</tbody>
		</table>
		
		<?=$this->pagination->create_links();?>
	</div>
</div>

<iframe name="downloadframe" style="display:none"></iframe>

<script>
$(document).ready(function() {
	$(".bill-view").each(function(){
		var btn = $(this);
	    btn.click(function(){window.open('/index.php/bill/detail/' + btn.attr('id'));})
	});
});
</script>
